﻿<CodeSnippetTabbed DocLink="https://docs.devexpress.com/Blazor/DevExpress.Blazor.DxDataGrid-1.SelectionMode#single-selection">
    <CodeSnippetTabPage Text="Razor">@(@"<DxDataGrid Data=""@DataSource""
            @bind-SingleSelectedDataRow=""@SelectedProduct""
            CssClass=""mw-1100"">
    <DxDataGridColumn Field=""@nameof(ProductFlat.ProductName)"" Caption=""Product Name""></DxDataGridColumn>
    <DxDataGridColumn Field=""@nameof(ProductFlat.Category)""></DxDataGridColumn>
    <DxDataGridColumn Field=""@nameof(ProductFlat.Subcategory)""></DxDataGridColumn>
</DxDataGrid>

@code {
    IEnumerable<ProductFlat> DataSource;

    ProductFlat selectedProduct;
    public ProductFlat SelectedProduct {
        get { return selectedProduct; }
        set {
            selectedProduct = value;
            InvokeAsync(StateHasChanged);
        }
    }

    protected override async Task OnInitializedAsync() {
        DataSource = await FlatProductService.LoadAsync();
        SelectedProduct = DataSource.First();
    }
}")</CodeSnippetTabPage>
</CodeSnippetTabbed>
